<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.linenumber {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='linenumber'>  1</span> <span class="COMM">/*
<span class='linenumber'>  2</span>  * ====================================================================
<span class='linenumber'>  3</span>  * About Sarissa: http://dev.abiss.gr/sarissa
<span class='linenumber'>  4</span>  * ====================================================================
<span class='linenumber'>  5</span>  * Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs.
<span class='linenumber'>  6</span>  * The library supports Gecko based browsers like Mozilla and Firefox,
<span class='linenumber'>  7</span>  * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and Opera
<span class='linenumber'>  8</span>  * @version 0.9.9.4
<span class='linenumber'>  9</span>  * @author: Copyright 2004-2008 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net
<span class='linenumber'> 10</span>  * ====================================================================
<span class='linenumber'> 11</span>  * Licence
<span class='linenumber'> 12</span>  * ====================================================================
<span class='linenumber'> 13</span>  * Sarissa is free software distributed under the GNU GPL version 2 (see &lt;a href="gpl.txt">gpl.txt&lt;/a>) or higher, 
<span class='linenumber'> 14</span>  * GNU LGPL version 2.1 (see &lt;a href="lgpl.txt">lgpl.txt&lt;/a>) or higher and Apache Software License 2.0 or higher 
<span class='linenumber'> 15</span>  * (see &lt;a href="asl.txt">asl.txt&lt;/a>). This means you can choose one of the three and use that if you like. If 
<span class='linenumber'> 16</span>  * you make modifications under the ASL, i would appreciate it if you submitted those.
<span class='linenumber'> 17</span>  * In case your copy of Sarissa does not include the license texts, you may find
<span class='linenumber'> 18</span>  * them online in various formats at &lt;a href="http://www.gnu.org">http://www.gnu.org&lt;/a> and 
<span class='linenumber'> 19</span>  * &lt;a href="http://www.apache.org">http://www.apache.org&lt;/a>.
<span class='linenumber'> 20</span>  *
<span class='linenumber'> 21</span>  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 
<span class='linenumber'> 22</span>  * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
<span class='linenumber'> 23</span>  * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 
<span class='linenumber'> 24</span>  * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
<span class='linenumber'> 25</span>  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
<span class='linenumber'> 26</span>  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
<span class='linenumber'> 27</span>  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
<span class='linenumber'> 28</span>  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<span class='linenumber'> 29</span>  */</span><span class="WHIT">
<span class='linenumber'> 30</span> </span><span class="COMM">/**
<span class='linenumber'> 31</span>  * &lt;p>Sarissa is a utility class. Provides "static" methods for DOMDocument, 
<span class='linenumber'> 32</span>  * DOM Node serialization to XML strings and other utility goodies.&lt;/p>
<span class='linenumber'> 33</span>  * @constructor
<span class='linenumber'> 34</span>  * @static
<span class='linenumber'> 35</span>  */</span><span class="WHIT">
<span class='linenumber'> 36</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">Sarissa</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 37</span> </span><span class="NAME">Sarissa.VERSION</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"0.9.9.4"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 38</span> </span><span class="NAME">Sarissa.PARSED_OK</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"Document contains no parsing errors"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 39</span> </span><span class="NAME">Sarissa.PARSED_EMPTY</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"Document is empty"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 40</span> </span><span class="NAME">Sarissa.PARSED_UNKNOWN_ERROR</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"Not well-formed or other error"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 41</span> </span><span class="NAME">Sarissa.IS_ENABLED_TRANSFORM_NODE</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 42</span> </span><span class="NAME">Sarissa.REMOTE_CALL_FLAG</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"gr.abiss.sarissa.REMOTE_CALL_FLAG"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 43</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 44</span> </span><span class="NAME">Sarissa._lastUniqueSuffix</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 45</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 46</span> </span><span class="NAME">Sarissa._getUniqueSuffix</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 47</span> 	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Sarissa._lastUniqueSuffix</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 48</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 49</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 50</span> </span><span class="NAME">Sarissa._SARISSA_IEPREFIX4XSLPARAM</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 51</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 52</span> </span><span class="NAME">Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.implementation</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 53</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 54</span> </span><span class="NAME">Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">document.implementation.createDocument</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 55</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 56</span> </span><span class="NAME">Sarissa._SARISSA_HAS_DOM_FEATURE</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">document.implementation.hasFeature</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 57</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 58</span> </span><span class="NAME">Sarissa._SARISSA_IS_MOZ</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">Sarissa._SARISSA_HAS_DOM_FEATURE</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 59</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 60</span> </span><span class="NAME">Sarissa._SARISSA_IS_SAFARI</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">navigator.userAgent.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">"safari"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">navigator.userAgent.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">"konqueror"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 61</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 62</span> </span><span class="NAME">Sarissa._SARISSA_IS_SAFARI_OLD</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa._SARISSA_IS_SAFARI</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">navigator.userAgent.match</span><span class="PUNC">(</span><span class="REGX">/AppleWebKit\/(\d+)/</span><span class="PUNC">)</span><span class="PUNC">||</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">420</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 63</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 64</span> </span><span class="NAME">Sarissa._SARISSA_IS_IE</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.all</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">window.ActiveXObject</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">navigator.userAgent.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">"msie"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT">  </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">navigator.userAgent.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">"opera"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 65</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'> 66</span> </span><span class="NAME">Sarissa._SARISSA_IS_OPERA</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">navigator.userAgent.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">"opera"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 67</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">window.Node</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">Node.ELEMENT_NODE</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 68</span>     </span><span class="NAME">Node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">ELEMENT_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ATTRIBUTE_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">TEXT_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">3</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CDATA_SECTION_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ENTITY_REFERENCE_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">5</span><span class="PUNC">,</span><span class="WHIT">  </span><span class="NAME">ENTITY_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">6</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">PROCESSING_INSTRUCTION_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">7</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">COMMENT_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">8</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">DOCUMENT_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">9</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">DOCUMENT_TYPE_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">DOCUMENT_FRAGMENT_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">11</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">NOTATION_NODE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">12</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 69</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 70</span> 
<span class='linenumber'> 71</span> </span><span class="COMM">//This breaks for(x in o) loops in the old Safari</span><span class="WHIT">
<span class='linenumber'> 72</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">Sarissa._SARISSA_IS_SAFARI_OLD</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 73</span> 	</span><span class="NAME">HTMLHtmlElement</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">"html"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">constructor</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 74</span> 	</span><span class="NAME">Node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">HTMLElement</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 75</span> 	</span><span class="NAME">HTMLElement.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">HTMLHtmlElement.__proto__.__proto__</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 76</span> 	</span><span class="NAME">HTMLDocument</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Document</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.constructor</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 77</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">DOMParser</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 78</span> 	</span><span class="NAME">XMLDocument</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">x.constructor</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 79</span> 	</span><span class="NAME">Element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">x.parseFromString</span><span class="PUNC">(</span><span class="STRN">"&lt;Single />"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"text/xml"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">documentElement.constructor</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 80</span> 	</span><span class="NAME">x</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 81</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 82</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">XMLDocument</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">Document</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">XMLDocument</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Document</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> 
<span class='linenumber'> 83</span> 
<span class='linenumber'> 84</span> </span><span class="COMM">// IE initialization</span><span class="WHIT">
<span class='linenumber'> 85</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">Sarissa._SARISSA_IS_IE</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 86</span>     </span><span class="COMM">// for XSLT parameter names, prefix needed by IE</span><span class="WHIT">
<span class='linenumber'> 87</span>     </span><span class="NAME">Sarissa._SARISSA_IEPREFIX4XSLPARAM</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"xsl:"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 88</span>     </span><span class="COMM">// used to store the most recent ProgID available out of the above</span><span class="WHIT">
<span class='linenumber'> 89</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_SARISSA_DOM_PROGID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 90</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_SARISSA_XMLHTTP_PROGID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 91</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_SARISSA_DOM_XMLWRITER</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 92</span>     </span><span class="COMM">/**
<span class='linenumber'> 93</span>      * Called when the sarissa.js file is parsed, to pick most recent
<span class='linenumber'> 94</span>      * ProgIDs for IE, then gets destroyed.
<span class='linenumber'> 95</span>      * @memberOf Sarissa
<span class='linenumber'> 96</span>      * @private
<span class='linenumber'> 97</span>      * @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object
<span class='linenumber'> 98</span>      * @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled
<span class='linenumber'> 99</span>      */</span><span class="WHIT">
<span class='linenumber'>100</span>     </span><span class="NAME">Sarissa.pickRecentProgID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">idList</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>101</span>         </span><span class="COMM">// found progID flag</span><span class="WHIT">
<span class='linenumber'>102</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">bFound</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>103</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">o2Store</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>104</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">idList.length</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">bFound</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>105</span>             </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>106</span>                 </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">idList</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>107</span>                 </span><span class="NAME">o2Store</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">idList</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>108</span>                 </span><span class="NAME">bFound</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>109</span>             </span><span class="PUNC">}</span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">objException</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>110</span>                 </span><span class="COMM">// trap; try next progID</span><span class="WHIT">
<span class='linenumber'>111</span>                 </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">objException</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>112</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>113</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>114</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">bFound</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>115</span>             </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"Could not retrieve a valid progID of Class: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">idList</span><span class="PUNC">[</span><span class="NAME">idList.length</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">+</span><span class="STRN">". (original exception: "</span><span class="PUNC">+</span><span class="NAME">e</span><span class="PUNC">+</span><span class="STRN">")"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>116</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>117</span>         </span><span class="NAME">idList</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>118</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">o2Store</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>119</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>120</span>     </span><span class="COMM">// pick best available MSXML progIDs</span><span class="WHIT">
<span class='linenumber'>121</span>     </span><span class="NAME">_SARISSA_DOM_PROGID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>122</span>     </span><span class="NAME">_SARISSA_THREADEDDOM_PROGID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>123</span>     </span><span class="NAME">_SARISSA_XSLTEMPLATE_PROGID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>124</span>     </span><span class="NAME">_SARISSA_XMLHTTP_PROGID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>125</span>     </span><span class="COMM">// commenting the condition out; we need to redefine XMLHttpRequest </span><span class="WHIT">
<span class='linenumber'>126</span>     </span><span class="COMM">// anyway as IE7 hardcodes it to MSXML3.0 causing version problems </span><span class="WHIT">
<span class='linenumber'>127</span>     </span><span class="COMM">// between different activex controls </span><span class="WHIT">
<span class='linenumber'>128</span>     </span><span class="COMM">//if(!window.XMLHttpRequest){</span><span class="WHIT">
<span class='linenumber'>129</span>     </span><span class="COMM">/**
<span class='linenumber'>130</span>      * Emulate XMLHttpRequest
<span class='linenumber'>131</span>      * @constructor
<span class='linenumber'>132</span>      */</span><span class="WHIT">
<span class='linenumber'>133</span>     </span><span class="NAME">XMLHttpRequest</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>134</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">_SARISSA_XMLHTTP_PROGID</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>135</span>             </span><span class="NAME">_SARISSA_XMLHTTP_PROGID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.pickRecentProgID</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="STRN">"Msxml2.XMLHTTP.6.0"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"MSXML2.XMLHTTP.3.0"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"MSXML2.XMLHTTP"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"Microsoft.XMLHTTP"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>136</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>137</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">_SARISSA_XMLHTTP_PROGID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>138</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>139</span>     </span><span class="COMM">//}</span><span class="WHIT">
<span class='linenumber'>140</span>     </span><span class="COMM">// we dont need this anymore</span><span class="WHIT">
<span class='linenumber'>141</span>     </span><span class="COMM">//============================================</span><span class="WHIT">
<span class='linenumber'>142</span>     </span><span class="COMM">// Factory methods (IE)</span><span class="WHIT">
<span class='linenumber'>143</span>     </span><span class="COMM">//============================================</span><span class="WHIT">
<span class='linenumber'>144</span>     </span><span class="COMM">// see non-IE version</span><span class="WHIT">
<span class='linenumber'>145</span>     </span><span class="NAME">Sarissa.getDomDocument</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sName</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>146</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">_SARISSA_DOM_PROGID</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>147</span>             </span><span class="NAME">_SARISSA_DOM_PROGID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.pickRecentProgID</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="STRN">"Msxml2.DOMDocument.6.0"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"Msxml2.DOMDocument.3.0"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"MSXML2.DOMDocument"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"MSXML.DOMDocument"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"Microsoft.XMLDOM"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>148</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>149</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">_SARISSA_DOM_PROGID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>150</span>         </span><span class="COMM">// if a root tag name was provided, we need to load it in the DOM object</span><span class="WHIT">
<span class='linenumber'>151</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sName</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>152</span>             </span><span class="COMM">// create an artifical namespace prefix </span><span class="WHIT">
<span class='linenumber'>153</span>             </span><span class="COMM">// or reuse existing prefix if applicable</span><span class="WHIT">
<span class='linenumber'>154</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">prefix</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>155</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>156</span>                 </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">sName.indexOf</span><span class="PUNC">(</span><span class="STRN">":"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>157</span>                     </span><span class="NAME">prefix</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sName.substring</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sName.indexOf</span><span class="PUNC">(</span><span class="STRN">":"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>158</span>                     </span><span class="NAME">sName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sName.substring</span><span class="PUNC">(</span><span class="NAME">sName.indexOf</span><span class="PUNC">(</span><span class="STRN">":"</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>159</span>                 </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>160</span>                     </span><span class="NAME">prefix</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"a"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">Sarissa._getUniqueSuffix</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>161</span>                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>162</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>163</span>             </span><span class="COMM">// use namespaces if a namespace URI exists</span><span class="WHIT">
<span class='linenumber'>164</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>165</span>                 </span><span class="NAME">oDoc.loadXML</span><span class="PUNC">(</span><span class="STRN">'&lt;'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">prefix</span><span class="PUNC">+</span><span class="STRN">':'</span><span class="PUNC">+</span><span class="NAME">sName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" xmlns:"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">prefix</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"=\""</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">sUri</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"\""</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" />"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>166</span>             </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>167</span>                 </span><span class="NAME">oDoc.loadXML</span><span class="PUNC">(</span><span class="STRN">'&lt;'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">sName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" />"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>168</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>169</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>170</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>171</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>172</span>     </span><span class="COMM">// see non-IE version   </span><span class="WHIT">
<span class='linenumber'>173</span>     </span><span class="NAME">Sarissa.getParseErrorText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">oDoc</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>174</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.PARSED_OK</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>175</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oDoc</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">oDoc.parseError</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">oDoc.parseError.errorCode</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">oDoc.parseError.errorCode</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>176</span>             </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"XML Parsing Error: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">oDoc.parseError.reason</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='linenumber'>177</span>                 </span><span class="STRN">"\nLocation: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">oDoc.parseError.url</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='linenumber'>178</span>                 </span><span class="STRN">"\nLine Number "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">oDoc.parseError.line</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">", Column "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='linenumber'>179</span>                 </span><span class="NAME">oDoc.parseError.linepos</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='linenumber'>180</span>                 </span><span class="STRN">":\n"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">oDoc.parseError.srcText</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='linenumber'>181</span>                 </span><span class="STRN">"\n"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>182</span>             </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">  </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">oDoc.parseError.linepos</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>183</span>                 </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"-"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>184</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>185</span>             </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT">  </span><span class="STRN">"^\n"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>186</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>187</span>         </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oDoc.documentElement</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>188</span>             </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.PARSED_EMPTY</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>189</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>190</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">parseErrorText</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>191</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>192</span>     </span><span class="COMM">// see non-IE version</span><span class="WHIT">
<span class='linenumber'>193</span>     </span><span class="NAME">Sarissa.setXpathNamespaces</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oDoc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sNsSet</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>194</span>         </span><span class="NAME">oDoc.setProperty</span><span class="PUNC">(</span><span class="STRN">"SelectionLanguage"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"XPath"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>195</span>         </span><span class="NAME">oDoc.setProperty</span><span class="PUNC">(</span><span class="STRN">"SelectionNamespaces"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sNsSet</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>196</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>197</span>     </span><span class="COMM">/**
<span class='linenumber'>198</span>      * A class that reuses the same XSLT stylesheet for multiple transforms.
<span class='linenumber'>199</span>      * @constructor
<span class='linenumber'>200</span>      */</span><span class="WHIT">
<span class='linenumber'>201</span>     </span><span class="NAME">XSLTProcessor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>202</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">_SARISSA_XSLTEMPLATE_PROGID</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>203</span>             </span><span class="NAME">_SARISSA_XSLTEMPLATE_PROGID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.pickRecentProgID</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="STRN">"Msxml2.XSLTemplate.6.0"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"MSXML2.XSLTemplate.3.0"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>204</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>205</span>         </span><span class="NAME">this.template</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">_SARISSA_XSLTEMPLATE_PROGID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>206</span>         </span><span class="NAME">this.processor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>207</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>208</span>     </span><span class="COMM">/**
<span class='linenumber'>209</span>      * Imports the given XSLT DOM and compiles it to a reusable transform
<span class='linenumber'>210</span>      * &lt;b>Note:&lt;/b> If the stylesheet was loaded from a URL and contains xsl:import or xsl:include elements,it will be reloaded to resolve those
<span class='linenumber'>211</span>      * @param {DOMDocument} xslDoc The XSLT DOMDocument to import
<span class='linenumber'>212</span>      */</span><span class="WHIT">
<span class='linenumber'>213</span>     </span><span class="NAME">XSLTProcessor.prototype.importStylesheet</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">xslDoc</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>214</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">_SARISSA_THREADEDDOM_PROGID</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>215</span>             </span><span class="NAME">_SARISSA_THREADEDDOM_PROGID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.pickRecentProgID</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="STRN">"MSXML2.FreeThreadedDOMDocument.6.0"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"MSXML2.FreeThreadedDOMDocument.3.0"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>216</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>217</span>         </span><span class="NAME">xslDoc.setProperty</span><span class="PUNC">(</span><span class="STRN">"SelectionLanguage"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"XPath"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>218</span>         </span><span class="NAME">xslDoc.setProperty</span><span class="PUNC">(</span><span class="STRN">"SelectionNamespaces"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>219</span>         </span><span class="COMM">// convert stylesheet to free threaded</span><span class="WHIT">
<span class='linenumber'>220</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">converted</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">_SARISSA_THREADEDDOM_PROGID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>221</span>         </span><span class="COMM">// make included/imported stylesheets work if exist and xsl was originally loaded from url</span><span class="WHIT">
<span class='linenumber'>222</span>         </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>223</span>             </span><span class="NAME">converted.resolveExternals</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>224</span>             </span><span class="NAME">converted.setProperty</span><span class="PUNC">(</span><span class="STRN">"AllowDocumentFunction"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>225</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>226</span>         </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>227</span>             </span><span class="COMM">// Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later.</span><span class="WHIT">
<span class='linenumber'>228</span>         </span><span class="PUNC">}</span><span class="WHIT"> 
<span class='linenumber'>229</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">xslDoc.url</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">xslDoc.selectSingleNode</span><span class="PUNC">(</span><span class="STRN">"//xsl:*[local-name() = 'import' or local-name() = 'include']"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>230</span>             </span><span class="NAME">converted.async</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>231</span>             </span><span class="NAME">converted.load</span><span class="PUNC">(</span><span class="NAME">xslDoc.url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>232</span>         </span><span class="PUNC">}</span><span class="WHIT"> 
<span class='linenumber'>233</span>         </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>234</span>             </span><span class="NAME">converted.loadXML</span><span class="PUNC">(</span><span class="NAME">xslDoc.xml</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>235</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>236</span>         </span><span class="NAME">converted.setProperty</span><span class="PUNC">(</span><span class="STRN">"SelectionNamespaces"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>237</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">output</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">converted.selectSingleNode</span><span class="PUNC">(</span><span class="STRN">"//xsl:output"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>238</span>         </span><span class="COMM">//this.outputMethod = output ? output.getAttribute("method") : "html";</span><span class="WHIT">
<span class='linenumber'>239</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">output</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>240</span>             </span><span class="NAME">this.outputMethod</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">output.getAttribute</span><span class="PUNC">(</span><span class="STRN">"method"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>241</span>         </span><span class="PUNC">}</span><span class="WHIT"> 
<span class='linenumber'>242</span>         </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>243</span>             </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">this.outputMethod</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>244</span>         </span><span class="PUNC">}</span><span class="WHIT"> 
<span class='linenumber'>245</span>         </span><span class="NAME">this.template.stylesheet</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">converted</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>246</span>         </span><span class="NAME">this.processor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.template.createProcessor</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>247</span>         </span><span class="COMM">// for getParameter and clearParameters</span><span class="WHIT">
<span class='linenumber'>248</span>         </span><span class="NAME">this.paramsSet</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>249</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>250</span> 
<span class='linenumber'>251</span>     </span><span class="COMM">/**
<span class='linenumber'>252</span>      * Transform the given XML DOM and return the transformation result as a new DOM document
<span class='linenumber'>253</span>      * @param {DOMDocument} sourceDoc The XML DOMDocument to transform
<span class='linenumber'>254</span>      * @return {DOMDocument} The transformation result as a DOM Document
<span class='linenumber'>255</span>      */</span><span class="WHIT">
<span class='linenumber'>256</span>     </span><span class="NAME">XSLTProcessor.prototype.transformToDocument</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sourceDoc</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>257</span>         </span><span class="COMM">// fix for bug 1549749</span><span class="WHIT">
<span class='linenumber'>258</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">outDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>259</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">_SARISSA_THREADEDDOM_PROGID</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>260</span>             </span><span class="NAME">this.processor.input</span><span class="PUNC">=</span><span class="NAME">sourceDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>261</span>             </span><span class="NAME">outDoc</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">_SARISSA_DOM_PROGID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>262</span>             </span><span class="NAME">this.processor.output</span><span class="PUNC">=</span><span class="NAME">outDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>263</span>             </span><span class="NAME">this.processor.transform</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>264</span>             </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">outDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>265</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>266</span>         </span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>267</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">_SARISSA_DOM_XMLWRITER</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>268</span>                 </span><span class="NAME">_SARISSA_DOM_XMLWRITER</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.pickRecentProgID</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="STRN">"Msxml2.MXXMLWriter.6.0"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"Msxml2.MXXMLWriter.3.0"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"MSXML2.MXXMLWriter"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"MSXML.MXXMLWriter"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"Microsoft.XMLDOM"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>269</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>270</span>             </span><span class="NAME">this.processor.input</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sourceDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>271</span>             </span><span class="NAME">outDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">_SARISSA_DOM_XMLWRITER</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>272</span>             </span><span class="NAME">this.processor.output</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">outDoc</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>273</span>             </span><span class="NAME">this.processor.transform</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>274</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">_SARISSA_DOM_PROGID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>275</span>             </span><span class="NAME">oDoc.loadXML</span><span class="PUNC">(</span><span class="NAME">outDoc.output</span><span class="PUNC">+</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>276</span>             </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>277</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>278</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>279</span>     
<span class='linenumber'>280</span>     </span><span class="COMM">/**
<span class='linenumber'>281</span>      * Transform the given XML DOM and return the transformation result as a new DOM fragment.
<span class='linenumber'>282</span>      * &lt;b>Note&lt;/b>: The xsl:output method must match the nature of the owner document (XML/HTML).
<span class='linenumber'>283</span>      * @param {DOMDocument} sourceDoc The XML DOMDocument to transform
<span class='linenumber'>284</span>      * @param {DOMDocument} ownerDoc The owner of the result fragment
<span class='linenumber'>285</span>      * @return {DOMDocument} The transformation result as a DOM Document
<span class='linenumber'>286</span>      */</span><span class="WHIT">
<span class='linenumber'>287</span>     </span><span class="NAME">XSLTProcessor.prototype.transformToFragment</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sourceDoc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ownerDoc</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>288</span>         </span><span class="NAME">this.processor.input</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sourceDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>289</span>         </span><span class="NAME">this.processor.transform</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>290</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.processor.output</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>291</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">f</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ownerDoc.createDocumentFragment</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>292</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">container</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>293</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.outputMethod</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'text'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>294</span>             </span><span class="NAME">f.appendChild</span><span class="PUNC">(</span><span class="NAME">ownerDoc.createTextNode</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>295</span>         </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ownerDoc.body</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">ownerDoc.body.innerHTML</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>296</span>             </span><span class="NAME">container</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ownerDoc.createElement</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>297</span>             </span><span class="NAME">container.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>298</span>             </span><span class="KEYW">while</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">container.hasChildNodes</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>299</span>                 </span><span class="NAME">f.appendChild</span><span class="PUNC">(</span><span class="NAME">container.firstChild</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>300</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>301</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>302</span>         </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>303</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="NAME">_SARISSA_DOM_PROGID</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>304</span>             </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">s.substring</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">5</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'&lt;?xml'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>305</span>                 </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.substring</span><span class="PUNC">(</span><span class="NAME">s.indexOf</span><span class="PUNC">(</span><span class="STRN">'?>'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>306</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>307</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">xml</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">.</span><span class="NAME">concat</span><span class="PUNC">(</span><span class="STRN">'&lt;my>'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'&lt;/my>'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>308</span>             </span><span class="NAME">oDoc.loadXML</span><span class="PUNC">(</span><span class="NAME">xml</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>309</span>             </span><span class="NAME">container</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oDoc.documentElement</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>310</span>             </span><span class="KEYW">while</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">container.hasChildNodes</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>311</span>                 </span><span class="NAME">f.appendChild</span><span class="PUNC">(</span><span class="NAME">container.firstChild</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>312</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>313</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>314</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>315</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>316</span>     
<span class='linenumber'>317</span>     </span><span class="COMM">/**
<span class='linenumber'>318</span>      * Set global XSLT parameter of the imported stylesheet
<span class='linenumber'>319</span>      * @param {String} nsURI The parameter namespace URI
<span class='linenumber'>320</span>      * @param {String} name The parameter base name
<span class='linenumber'>321</span>      * @param {String} value The new parameter value
<span class='linenumber'>322</span>      */</span><span class="WHIT">
<span class='linenumber'>323</span>      </span><span class="NAME">XSLTProcessor.prototype.setParameter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">nsURI</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>324</span>          </span><span class="COMM">// make value a zero length string if null to allow clearing</span><span class="WHIT">
<span class='linenumber'>325</span>          </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>326</span>          </span><span class="COMM">// nsURI is optional but cannot be null</span><span class="WHIT">
<span class='linenumber'>327</span>          </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">nsURI</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>328</span>              </span><span class="NAME">this.processor.addParameter</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nsURI</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>329</span>          </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>330</span>              </span><span class="NAME">this.processor.addParameter</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>331</span>          </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>332</span>          </span><span class="COMM">// update updated params for getParameter</span><span class="WHIT">
<span class='linenumber'>333</span>          </span><span class="NAME">nsURI</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nsURI</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>334</span>          </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.paramsSet</span><span class="PUNC">[</span><span class="NAME">nsURI</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>335</span>              </span><span class="NAME">this.paramsSet</span><span class="PUNC">[</span><span class="NAME">nsURI</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>336</span>          </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>337</span>          </span><span class="NAME">this.paramsSet</span><span class="PUNC">[</span><span class="NAME">nsURI</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>338</span>      </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>339</span>     </span><span class="COMM">/**
<span class='linenumber'>340</span>      * Gets a parameter if previously set by setParameter. Returns null
<span class='linenumber'>341</span>      * otherwise
<span class='linenumber'>342</span>      * @param {String} name The parameter base name
<span class='linenumber'>343</span>      * @param {String} value The new parameter value
<span class='linenumber'>344</span>      * @return {String} The parameter value if reviously set by setParameter, null otherwise
<span class='linenumber'>345</span>      */</span><span class="WHIT">
<span class='linenumber'>346</span>     </span><span class="NAME">XSLTProcessor.prototype.getParameter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">nsURI</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>347</span>         </span><span class="NAME">nsURI</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nsURI</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>348</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.paramsSet</span><span class="PUNC">[</span><span class="NAME">nsURI</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.paramsSet</span><span class="PUNC">[</span><span class="NAME">nsURI</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>349</span>             </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.paramsSet</span><span class="PUNC">[</span><span class="NAME">nsURI</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>350</span>         </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>351</span>             </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>352</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>353</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>354</span>     
<span class='linenumber'>355</span>     </span><span class="COMM">/**
<span class='linenumber'>356</span>      * Clear parameters (set them to default values as defined in the stylesheet itself)
<span class='linenumber'>357</span>      */</span><span class="WHIT">
<span class='linenumber'>358</span>     </span><span class="NAME">XSLTProcessor.prototype.clearParameters</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>359</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nsURI</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">this.paramsSet</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>360</span>             </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">this.paramsSet</span><span class="PUNC">[</span><span class="NAME">nsURI</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>361</span>                 </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">nsURI</span><span class="PUNC">!=</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>362</span>                     </span><span class="NAME">this.processor.addParameter</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nsURI</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>363</span>                 </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>364</span>                     </span><span class="NAME">this.processor.addParameter</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>365</span>                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>366</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>367</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>368</span>         </span><span class="NAME">this.paramsSet</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>369</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>370</span> </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">/* end IE initialization, try to deal with real browsers now ;-) */</span><span class="WHIT">
<span class='linenumber'>371</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>372</span>         </span><span class="COMM">/**
<span class='linenumber'>373</span>          * &lt;p>Ensures the document was loaded correctly, otherwise sets the
<span class='linenumber'>374</span>          * parseError to -1 to indicate something went wrong. Internal use&lt;/p>
<span class='linenumber'>375</span>          * @private
<span class='linenumber'>376</span>          */</span><span class="WHIT">
<span class='linenumber'>377</span>         </span><span class="NAME">Sarissa.__handleLoad__</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oDoc</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>378</span>             </span><span class="NAME">Sarissa.__setReadyState__</span><span class="PUNC">(</span><span class="NAME">oDoc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>379</span>         </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>380</span>         </span><span class="COMM">/**
<span class='linenumber'>381</span>         * &lt;p>Attached by an event handler to the load event. Internal use.&lt;/p>
<span class='linenumber'>382</span>         * @private
<span class='linenumber'>383</span>         */</span><span class="WHIT">
<span class='linenumber'>384</span>         </span><span class="NAME">_sarissa_XMLDocument_onload</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>385</span>             </span><span class="NAME">Sarissa.__handleLoad__</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>386</span>         </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>387</span>         </span><span class="COMM">/**
<span class='linenumber'>388</span>          * &lt;p>Sets the readyState property of the given DOM Document object.
<span class='linenumber'>389</span>          * Internal use.&lt;/p>
<span class='linenumber'>390</span>          * @memberOf Sarissa
<span class='linenumber'>391</span>          * @private
<span class='linenumber'>392</span>          * @param oDoc the DOM Document object to fire the
<span class='linenumber'>393</span>          *          readystatechange event
<span class='linenumber'>394</span>          * @param iReadyState the number to change the readystate property to
<span class='linenumber'>395</span>          */</span><span class="WHIT">
<span class='linenumber'>396</span>         </span><span class="NAME">Sarissa.__setReadyState__</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oDoc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">iReadyState</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>397</span>             </span><span class="NAME">oDoc.readyState</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">iReadyState</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>398</span>             </span><span class="NAME">oDoc.readystate</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">iReadyState</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>399</span>             </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">oDoc.onreadystatechange</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">oDoc.onreadystatechange</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"function"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>400</span>                 </span><span class="NAME">oDoc.onreadystatechange</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>401</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>402</span>         </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>403</span>         
<span class='linenumber'>404</span>         </span><span class="NAME">Sarissa.getDomDocument</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sName</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>405</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.implementation.createDocument</span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="PUNC">?</span><span class="NAME">sUri</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sName</span><span class="PUNC">?</span><span class="NAME">sName</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>406</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">oDoc.onreadystatechange</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>407</span>             
<span class='linenumber'>408</span>                 </span><span class="COMM">/**
<span class='linenumber'>409</span>                 * &lt;p>Emulate IE's onreadystatechange attribute&lt;/p>
<span class='linenumber'>410</span>                 */</span><span class="WHIT">
<span class='linenumber'>411</span>                 </span><span class="NAME">oDoc.onreadystatechange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>412</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>413</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">oDoc.readyState</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>414</span>                 </span><span class="COMM">/**
<span class='linenumber'>415</span>                 * &lt;p>Emulates IE's readyState property, which always gives an integer from 0 to 4:&lt;/p>
<span class='linenumber'>416</span>                 * &lt;ul>&lt;li>1 == LOADING,&lt;/li>
<span class='linenumber'>417</span>                 * &lt;li>2 == LOADED,&lt;/li>
<span class='linenumber'>418</span>                 * &lt;li>3 == INTERACTIVE,&lt;/li>
<span class='linenumber'>419</span>                 * &lt;li>4 == COMPLETED&lt;/li>&lt;/ul>
<span class='linenumber'>420</span>                 */</span><span class="WHIT">
<span class='linenumber'>421</span>                 </span><span class="NAME">oDoc.readyState</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>422</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>423</span>             </span><span class="NAME">oDoc.addEventListener</span><span class="PUNC">(</span><span class="STRN">"load"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_sarissa_XMLDocument_onload</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>424</span>             </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>425</span>         </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>426</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">window.XMLDocument</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>427</span>             </span><span class="COMM">// do nothing</span><span class="WHIT">
<span class='linenumber'>428</span>         </span><span class="PUNC">}</span><span class="COMM">// TODO: check if the new document has content before trying to copynodes, check  for error handling in DOM 3 LS</span><span class="WHIT">
<span class='linenumber'>429</span>         </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">Sarissa._SARISSA_HAS_DOM_FEATURE</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">window.Document</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">Document.prototype.load</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">document.implementation.hasFeature</span><span class="PUNC">(</span><span class="STRN">'LS'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'3.0'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>430</span>     		</span><span class="COMM">//Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good</span><span class="WHIT">
<span class='linenumber'>431</span>             </span><span class="COMM">/**
<span class='linenumber'>432</span>             * &lt;p>Factory method to obtain a new DOM Document object&lt;/p>
<span class='linenumber'>433</span>             * @memberOf Sarissa
<span class='linenumber'>434</span>             * @param {String} sUri the namespace of the root node (if any)
<span class='linenumber'>435</span>             * @param {String} sUri the local name of the root node (if any)
<span class='linenumber'>436</span>             * @returns {DOMDOcument} a new DOM Document
<span class='linenumber'>437</span>             */</span><span class="WHIT">
<span class='linenumber'>438</span>             </span><span class="NAME">Sarissa.getDomDocument</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sName</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>439</span>                 </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.implementation.createDocument</span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="PUNC">?</span><span class="NAME">sUri</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sName</span><span class="PUNC">?</span><span class="NAME">sName</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>440</span>                 </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>441</span>             </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>442</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>443</span>         </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>444</span>             </span><span class="NAME">Sarissa.getDomDocument</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sName</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>445</span>                 </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.implementation.createDocument</span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="PUNC">?</span><span class="NAME">sUri</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sName</span><span class="PUNC">?</span><span class="NAME">sName</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>446</span>                 </span><span class="COMM">// looks like safari does not create the root element for some unknown reason</span><span class="WHIT">
<span class='linenumber'>447</span>                 </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oDoc</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">sName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">oDoc.documentElement</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>448</span>                     </span><span class="NAME">oDoc.appendChild</span><span class="PUNC">(</span><span class="NAME">oDoc.createElementNS</span><span class="PUNC">(</span><span class="NAME">sUri</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sName</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>449</span>                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>450</span>                 </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">oDoc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>451</span>             </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>452</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>453</span>     </span><span class="PUNC">}</span><span class="COMM">//if(Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT)</span><span class="WHIT">
<span class='linenumber'>454</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>455</span> </span><span class="COMM">//==========================================</span><span class="WHIT">
<span class='linenumber'>456</span> </span><span class="COMM">// Common stuff</span><span class="WHIT">
<span class='linenumber'>457</span> </span><span class="COMM">//==========================================</span><span class="WHIT">
<span class='linenumber'>458</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">window.DOMParser</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>459</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">Sarissa._SARISSA_IS_SAFARI</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>460</span>         </span><span class="COMM">/**
<span class='linenumber'>461</span>          * DOMParser is a utility class, used to construct DOMDocuments from XML strings
<span class='linenumber'>462</span>          * @constructor
<span class='linenumber'>463</span>          */</span><span class="WHIT">
<span class='linenumber'>464</span>         </span><span class="NAME">DOMParser</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>465</span>         </span><span class="COMM">/** 
<span class='linenumber'>466</span>         * Construct a new DOM Document from the given XMLstring
<span class='linenumber'>467</span>         * @param {String} sXml the given XML string
<span class='linenumber'>468</span>         * @param {String} contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 
<span class='linenumber'>469</span>         * @return {DOMDocument} a new DOM Document from the given XML string
<span class='linenumber'>470</span>         */</span><span class="WHIT">
<span class='linenumber'>471</span>         </span><span class="NAME">DOMParser.prototype.parseFromString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sXml</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">contentType</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>472</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">xmlhttp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XMLHttpRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>473</span>             </span><span class="NAME">xmlhttp.open</span><span class="PUNC">(</span><span class="STRN">"GET"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"data:text/xml;charset=utf-8,"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">sXml</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>474</span>             </span><span class="NAME">xmlhttp.send</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>475</span>             </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">xmlhttp.responseXML</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>476</span>         </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>477</span>     </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">Sarissa.getDomDocument</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">Sarissa.getDomDocument</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">Sarissa.getDomDocument</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"bar"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">xml</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>478</span>         </span><span class="NAME">DOMParser</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>479</span>         </span><span class="NAME">DOMParser.prototype.parseFromString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sXml</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">contentType</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>480</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">doc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.getDomDocument</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>481</span>             </span><span class="NAME">doc.loadXML</span><span class="PUNC">(</span><span class="NAME">sXml</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>482</span>             </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">doc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>483</span>         </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>484</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>485</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>486</span> 
<span class='linenumber'>487</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">document.importNode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">Sarissa._SARISSA_IS_IE</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>488</span>     </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>489</span>         </span><span class="COMM">/**
<span class='linenumber'>490</span>         * Implementation of importNode for the context window document in IE.
<span class='linenumber'>491</span>         * If &lt;code>oNode&lt;/code> is a TextNode, &lt;code>bChildren&lt;/code> is ignored.
<span class='linenumber'>492</span>         * @param {DOMNode} oNode the Node to import
<span class='linenumber'>493</span>         * @param {boolean} bChildren whether to include the children of oNode
<span class='linenumber'>494</span>         * @returns the imported node for further use
<span class='linenumber'>495</span>         */</span><span class="WHIT">
<span class='linenumber'>496</span>         </span><span class="NAME">document.importNode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bChildren</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>497</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tmp</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>498</span>             </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">oNode.nodeName</span><span class="PUNC">==</span><span class="STRN">'#text'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>499</span>                 </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">document.createTextNode</span><span class="PUNC">(</span><span class="NAME">oNode.data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>500</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>501</span>             </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>502</span>                 </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oNode.nodeName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"tbody"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">oNode.nodeName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"tr"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>503</span>                     </span><span class="NAME">tmp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">"table"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>504</span>                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>505</span>                 </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oNode.nodeName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"td"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>506</span>                     </span><span class="NAME">tmp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">"tr"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>507</span>                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>508</span>                 </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oNode.nodeName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"option"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>509</span>                     </span><span class="NAME">tmp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">"select"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>510</span>                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>511</span>                 </span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>512</span>                     </span><span class="NAME">tmp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">"div"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>513</span>                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>514</span>                 </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">bChildren</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>515</span>                     </span><span class="NAME">tmp.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oNode.xml</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">oNode.xml</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">oNode.outerHTML</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>516</span>                 </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>517</span>                     </span><span class="NAME">tmp.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oNode.xml</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">oNode.cloneNode</span><span class="PUNC">(</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">xml</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">oNode.cloneNode</span><span class="PUNC">(</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">outerHTML</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>518</span>                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>519</span>                 </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">tmp.getElementsByTagName</span><span class="PUNC">(</span><span class="STRN">"*"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>520</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>521</span>         </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>522</span>     </span><span class="PUNC">}</span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>523</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>524</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">Sarissa.getParseErrorText</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>525</span>     </span><span class="COMM">/**
<span class='linenumber'>526</span>      * &lt;p>Returns a human readable description of the parsing error. Usefull
<span class='linenumber'>527</span>      * for debugging. Tip: append the returned error string in a &lt;pre&gt;
<span class='linenumber'>528</span>      * element if you want to render it.&lt;/p>
<span class='linenumber'>529</span>      * &lt;p>Many thanks to Christian Stocker for the initial patch.&lt;/p>
<span class='linenumber'>530</span>      * @memberOf Sarissa
<span class='linenumber'>531</span>      * @param {DOMDocument} oDoc The target DOM document
<span class='linenumber'>532</span>      * @returns {String} The parsing error description of the target Document in
<span class='linenumber'>533</span>      *          human readable form (preformated text)
<span class='linenumber'>534</span>      */</span><span class="WHIT">
<span class='linenumber'>535</span>     </span><span class="NAME">Sarissa.getParseErrorText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">oDoc</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>536</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.PARSED_OK</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>537</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">oDoc</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">oDoc.documentElement</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>538</span>             </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.PARSED_EMPTY</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>539</span>         </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oDoc.documentElement.tagName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"parsererror"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>540</span>             </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oDoc.documentElement.firstChild.data</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>541</span>             </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"\n"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">  </span><span class="NAME">oDoc.documentElement.firstChild.nextSibling.firstChild.data</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>542</span>         </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oDoc.getElementsByTagName</span><span class="PUNC">(</span><span class="STRN">"parsererror"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>543</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">parsererror</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oDoc.getElementsByTagName</span><span class="PUNC">(</span><span class="STRN">"parsererror"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>544</span>             </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.getText</span><span class="PUNC">(</span><span class="NAME">parsererror</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">"\n"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>545</span>         </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oDoc.parseError</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">oDoc.parseError.errorCode</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>546</span>             </span><span class="NAME">parseErrorText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.PARSED_UNKNOWN_ERROR</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>547</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>548</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">parseErrorText</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>549</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>550</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>551</span> </span><span class="COMM">/**
<span class='linenumber'>552</span>  * Get a string with the concatenated values of all string nodes under the given node
<span class='linenumber'>553</span>  * @param {DOMNode} oNode the given DOM node
<span class='linenumber'>554</span>  * @param {boolean} deep whether to recursively scan the children nodes of the given node for text as well. Default is &lt;code>false&lt;/code>
<span class='linenumber'>555</span>  * @memberOf Sarissa 
<span class='linenumber'>556</span>  */</span><span class="WHIT">
<span class='linenumber'>557</span> </span><span class="NAME">Sarissa.getText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>558</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>559</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oNode.childNodes</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>560</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">nodes.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>561</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>562</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nodeType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">node.nodeType</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>563</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Node.TEXT_NODE</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Node.CDATA_SECTION_NODE</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>564</span>             </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">node.data</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>565</span>         </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">deep</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Node.ELEMENT_NODE</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Node.DOCUMENT_NODE</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Node.DOCUMENT_FRAGMENT_NODE</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>566</span>             </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.getText</span><span class="PUNC">(</span><span class="NAME">node</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>567</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>568</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>569</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>570</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>571</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">window.XMLSerializer</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">Sarissa.getDomDocument</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">Sarissa.getDomDocument</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">,</span><span class="STRN">"foo"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">xml</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>572</span>     </span><span class="COMM">/**
<span class='linenumber'>573</span>      * Utility class to serialize DOM Node objects to XML strings
<span class='linenumber'>574</span>      * @constructor
<span class='linenumber'>575</span>      */</span><span class="WHIT">
<span class='linenumber'>576</span>     </span><span class="NAME">XMLSerializer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>577</span>     </span><span class="COMM">/**
<span class='linenumber'>578</span>      * Serialize the given DOM Node to an XML string
<span class='linenumber'>579</span>      * @param {DOMNode} oNode the DOM Node to serialize
<span class='linenumber'>580</span>      */</span><span class="WHIT">
<span class='linenumber'>581</span>     </span><span class="NAME">XMLSerializer.prototype.serializeToString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oNode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>582</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">oNode.xml</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>583</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>584</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>585</span> 
<span class='linenumber'>586</span> </span><span class="COMM">/**
<span class='linenumber'>587</span>  * Strips tags from the given markup string. If the given string is 
<span class='linenumber'>588</span>  * &lt;code>undefined&lt;/code>, &lt;code>null&lt;/code> or empty, it is returned as is. 
<span class='linenumber'>589</span>  * @memberOf Sarissa
<span class='linenumber'>590</span>  * @param {String} s the string to strip the tags from
<span class='linenumber'>591</span>  */</span><span class="WHIT">
<span class='linenumber'>592</span> </span><span class="NAME">Sarissa.stripTags</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>593</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">?</span><span class="NAME">s.replace</span><span class="PUNC">(</span><span class="REGX">/&lt;[^>]+>/g</span><span class="PUNC">,</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">s</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>594</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>595</span> </span><span class="COMM">/**
<span class='linenumber'>596</span>  * &lt;p>Deletes all child nodes of the given node&lt;/p>
<span class='linenumber'>597</span>  * @memberOf Sarissa
<span class='linenumber'>598</span>  * @param {DOMNode} oNode the Node to empty
<span class='linenumber'>599</span>  */</span><span class="WHIT">
<span class='linenumber'>600</span> </span><span class="NAME">Sarissa.clearChildNodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oNode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>601</span>     </span><span class="COMM">// need to check for firstChild due to opera 8 bug with hasChildNodes</span><span class="WHIT">
<span class='linenumber'>602</span>     </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">oNode.firstChild</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>603</span>         </span><span class="NAME">oNode.removeChild</span><span class="PUNC">(</span><span class="NAME">oNode.firstChild</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>604</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>605</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>606</span> </span><span class="COMM">/**
<span class='linenumber'>607</span>  * &lt;p> Copies the childNodes of nodeFrom to nodeTo&lt;/p>
<span class='linenumber'>608</span>  * &lt;p> &lt;b>Note:&lt;/b> The second object's original content is deleted before 
<span class='linenumber'>609</span>  * the copy operation, unless you supply a true third parameter&lt;/p>
<span class='linenumber'>610</span>  * @memberOf Sarissa
<span class='linenumber'>611</span>  * @param {DOMNode} nodeFrom the Node to copy the childNodes from
<span class='linenumber'>612</span>  * @param {DOMNode} nodeTo the Node to copy the childNodes to
<span class='linenumber'>613</span>  * @param {boolean} bPreserveExisting whether to preserve the original content of nodeTo, default is false
<span class='linenumber'>614</span>  */</span><span class="WHIT">
<span class='linenumber'>615</span> </span><span class="NAME">Sarissa.copyChildNodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">nodeFrom</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nodeTo</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bPreserveExisting</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>616</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">Sarissa._SARISSA_IS_SAFARI</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">nodeTo.nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Node.DOCUMENT_NODE</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// SAFARI_OLD ??</span><span class="WHIT">
<span class='linenumber'>617</span>     	</span><span class="NAME">nodeTo</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nodeTo.documentElement</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//Apparently there's a bug in safari where you can't appendChild to a document node</span><span class="WHIT">
<span class='linenumber'>618</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>619</span>     
<span class='linenumber'>620</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">nodeFrom</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">nodeTo</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>621</span>         </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"Both source and destination nodes must be provided"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>622</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>623</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">bPreserveExisting</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>624</span>         </span><span class="NAME">Sarissa.clearChildNodes</span><span class="PUNC">(</span><span class="NAME">nodeTo</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>625</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>626</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ownerDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nodeTo.nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Node.DOCUMENT_NODE</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">nodeTo</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">nodeTo.ownerDocument</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>627</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nodeFrom.childNodes</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>628</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>629</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">ownerDoc.importNode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">  </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>630</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">nodes.length</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>631</span>             </span><span class="NAME">nodeTo.appendChild</span><span class="PUNC">(</span><span class="NAME">ownerDoc.importNode</span><span class="PUNC">(</span><span class="NAME">nodes</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>632</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>633</span>     </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>634</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">nodes.length</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>635</span>             </span><span class="NAME">nodeTo.appendChild</span><span class="PUNC">(</span><span class="NAME">nodes</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">cloneNode</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>636</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>637</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>638</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>639</span> 
<span class='linenumber'>640</span> </span><span class="COMM">/**
<span class='linenumber'>641</span>  * &lt;p> Moves the childNodes of nodeFrom to nodeTo&lt;/p>
<span class='linenumber'>642</span>  * &lt;p> &lt;b>Note:&lt;/b> The second object's original content is deleted before 
<span class='linenumber'>643</span>  * the move operation, unless you supply a true third parameter&lt;/p>
<span class='linenumber'>644</span>  * @memberOf Sarissa
<span class='linenumber'>645</span>  * @param {DOMNode} nodeFrom the Node to copy the childNodes from
<span class='linenumber'>646</span>  * @param {DOMNode} nodeTo the Node to copy the childNodes to
<span class='linenumber'>647</span>  * @param {boolean} bPreserveExisting whether to preserve the original content of nodeTo, default is
<span class='linenumber'>648</span>  */</span><span class="WHIT"> 
<span class='linenumber'>649</span> </span><span class="NAME">Sarissa.moveChildNodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">nodeFrom</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nodeTo</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bPreserveExisting</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>650</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">nodeFrom</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">nodeTo</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>651</span>         </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"Both source and destination nodes must be provided"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>652</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>653</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">bPreserveExisting</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>654</span>         </span><span class="NAME">Sarissa.clearChildNodes</span><span class="PUNC">(</span><span class="NAME">nodeTo</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>655</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>656</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nodeFrom.childNodes</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>657</span>     </span><span class="COMM">// if within the same doc, just move, else copy and delete</span><span class="WHIT">
<span class='linenumber'>658</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">nodeFrom.ownerDocument</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">nodeTo.ownerDocument</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>659</span>         </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">nodeFrom.firstChild</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>660</span>             </span><span class="NAME">nodeTo.appendChild</span><span class="PUNC">(</span><span class="NAME">nodeFrom.firstChild</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>661</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>662</span>     </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>663</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ownerDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nodeTo.nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Node.DOCUMENT_NODE</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">nodeTo</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">nodeTo.ownerDocument</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>664</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>665</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">ownerDoc.importNode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>666</span>            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">nodes.length</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>667</span>                </span><span class="NAME">nodeTo.appendChild</span><span class="PUNC">(</span><span class="NAME">ownerDoc.importNode</span><span class="PUNC">(</span><span class="NAME">nodes</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>668</span>            </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>669</span>         </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>670</span>            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">nodes.length</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>671</span>                </span><span class="NAME">nodeTo.appendChild</span><span class="PUNC">(</span><span class="NAME">nodes</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">cloneNode</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>672</span>            </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>673</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>674</span>         </span><span class="NAME">Sarissa.clearChildNodes</span><span class="PUNC">(</span><span class="NAME">nodeFrom</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>675</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>676</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>677</span> 
<span class='linenumber'>678</span> </span><span class="COMM">/** 
<span class='linenumber'>679</span>  * &lt;p>Serialize any &lt;strong>non&lt;/strong> DOM object to an XML string. All properties are serialized using the property name
<span class='linenumber'>680</span>  * as the XML element name. Array elements are rendered as &lt;code>array-item&lt;/code> elements, 
<span class='linenumber'>681</span>  * using their index/key as the value of the &lt;code>key&lt;/code> attribute.&lt;/p>
<span class='linenumber'>682</span>  * @memberOf Sarissa
<span class='linenumber'>683</span>  * @param {Object} anyObject the object to serialize
<span class='linenumber'>684</span>  * @param {String} objectName a name for that object, to be used as the root element name
<span class='linenumber'>685</span>  * @return {String} the XML serialization of the given object as a string
<span class='linenumber'>686</span>  */</span><span class="WHIT">
<span class='linenumber'>687</span> </span><span class="NAME">Sarissa.xmlize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">anyObject</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">objectName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">indentSpace</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>688</span>     </span><span class="NAME">indentSpace</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">indentSpace</span><span class="PUNC">?</span><span class="NAME">indentSpace</span><span class="PUNC">:</span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>689</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">indentSpace</span><span class="WHIT">  </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'&lt;'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">objectName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'>'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>690</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">isLeaf</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>691</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="NAME">anyObject</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Object</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">anyObject</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Number</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">anyObject</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">String</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">anyObject</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Boolean</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">anyObject</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>692</span>         </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.escape</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">+</span><span class="NAME">anyObject</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>693</span>         </span><span class="NAME">isLeaf</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>694</span>     </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>695</span>         </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"\n"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>696</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">isArrayItem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">anyObject</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>697</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">anyObject</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>698</span>             </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.xmlize</span><span class="PUNC">(</span><span class="NAME">anyObject</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isArrayItem</span><span class="PUNC">?</span><span class="STRN">"array-item key=\""</span><span class="PUNC">+</span><span class="NAME">name</span><span class="PUNC">+</span><span class="STRN">"\""</span><span class="PUNC">:</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">indentSpace</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"   "</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>699</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>700</span>         </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">indentSpace</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>701</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>702</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">objectName.indexOf</span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="PUNC">!=</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">?</span><span class="STRN">"&lt;/array-item>\n"</span><span class="PUNC">:</span><span class="STRN">"&lt;/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">objectName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">">\n"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>703</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>704</span> 
<span class='linenumber'>705</span> </span><span class="COMM">/** 
<span class='linenumber'>706</span>  * Escape the given string chacters that correspond to the five predefined XML entities
<span class='linenumber'>707</span>  * @memberOf Sarissa
<span class='linenumber'>708</span>  * @param {String} sXml the string to escape
<span class='linenumber'>709</span>  */</span><span class="WHIT">
<span class='linenumber'>710</span> </span><span class="NAME">Sarissa.escape</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sXml</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>711</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">sXml.replace</span><span class="PUNC">(</span><span class="REGX">/&/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"&amp;"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&lt;/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"&lt;"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/>/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"&gt;"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/"/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"&quot;"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/'/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"&apos;"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>712</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>713</span> 
<span class='linenumber'>714</span> </span><span class="COMM">/** 
<span class='linenumber'>715</span>  * Unescape the given string. This turns the occurences of the predefined XML 
<span class='linenumber'>716</span>  * entities to become the characters they represent correspond to the five predefined XML entities
<span class='linenumber'>717</span>  * @memberOf Sarissa
<span class='linenumber'>718</span>  * @param  {String}sXml the string to unescape
<span class='linenumber'>719</span>  */</span><span class="WHIT">
<span class='linenumber'>720</span> </span><span class="NAME">Sarissa.unescape</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sXml</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>721</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">sXml.replace</span><span class="PUNC">(</span><span class="REGX">/&apos;/g</span><span class="PUNC">,</span><span class="STRN">"'"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&quot;/g</span><span class="PUNC">,</span><span class="STRN">"\""</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&gt;/g</span><span class="PUNC">,</span><span class="STRN">">"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&lt;/g</span><span class="PUNC">,</span><span class="STRN">"&lt;"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&amp;/g</span><span class="PUNC">,</span><span class="STRN">"&"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>722</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>723</span> 
<span class='linenumber'>724</span> </span><span class="COMM">/** @private */</span><span class="WHIT">
<span class='linenumber'>725</span> </span><span class="NAME">Sarissa.updateCursor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sValue</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>726</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oTargetElement</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">oTargetElement.style</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">oTargetElement.style.cursor</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>727</span>         </span><span class="NAME">oTargetElement.style.cursor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sValue</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>728</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>729</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>730</span> 
<span class='linenumber'>731</span> </span><span class="COMM">/**
<span class='linenumber'>732</span>  * Asynchronously update an element with response of a GET request on the given URL.  Passing a configured XSLT 
<span class='linenumber'>733</span>  * processor will result in transforming and updating oNode before using it to update oTargetElement.
<span class='linenumber'>734</span>  * You can also pass a callback function to be executed when the update is finished. The function will be called as 
<span class='linenumber'>735</span>  * &lt;code>functionName(oNode, oTargetElement);&lt;/code>
<span class='linenumber'>736</span>  * @memberOf Sarissa
<span class='linenumber'>737</span>  * @param {String} sFromUrl the URL to make the request to
<span class='linenumber'>738</span>  * @param {DOMElement} oTargetElement the element to update
<span class='linenumber'>739</span>  * @param {XSLTProcessor} xsltproc (optional) the transformer to use on the returned
<span class='linenumber'>740</span>  *                  content before updating the target element with it
<span class='linenumber'>741</span>  * @param {Function} callback (optional) a Function object to execute once the update is finished successfuly, called as &lt;code>callback(sFromUrl, oTargetElement)&lt;/code>. 
<span class='linenumber'>742</span>  *        In case an exception is thrown during execution, the callback is called as called as &lt;code>callback(sFromUrl, oTargetElement, oException)&lt;/code>
<span class='linenumber'>743</span>  * @param {boolean} skipCache (optional) whether to skip any cache
<span class='linenumber'>744</span>  */</span><span class="WHIT">
<span class='linenumber'>745</span> </span><span class="NAME">Sarissa.updateContentFromURI</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sFromUrl</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">xsltproc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">skipCache</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>746</span>     </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>747</span>         </span><span class="NAME">Sarissa.updateCursor</span><span class="PUNC">(</span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"wait"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>748</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">xmlhttp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XMLHttpRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>749</span>         </span><span class="NAME">xmlhttp.open</span><span class="PUNC">(</span><span class="STRN">"GET"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sFromUrl</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>750</span>         </span><span class="NAME">xmlhttp.onreadystatechange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>751</span>             </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">xmlhttp.readyState</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>752</span>             	</span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>753</span>             		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oDomDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">xmlhttp.responseXML</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>754</span> 	            	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oDomDoc</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">Sarissa.getParseErrorText</span><span class="PUNC">(</span><span class="NAME">oDomDoc</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Sarissa.PARSED_OK</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>755</span> 		                </span><span class="NAME">Sarissa.updateContentFromNode</span><span class="PUNC">(</span><span class="NAME">xmlhttp.responseXML</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">xsltproc</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>756</span>         				</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>757</span> 		                	</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">sFromUrl</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>758</span> 		                </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>759</span> 	            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>760</span> 	            	</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>761</span> 	            		</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="NAME">Sarissa.getParseErrorText</span><span class="PUNC">(</span><span class="NAME">oDomDoc</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>762</span> 	            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>763</span>             	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>764</span>             	</span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>765</span>             		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>766</span> 			        	</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">sFromUrl</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>767</span> 			        </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>768</span> 			        </span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>769</span> 			        	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>770</span> 			        </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>771</span>             	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>772</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>773</span>         </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>774</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">skipCache</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>775</span>              </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldage</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"Sat, 1 Jan 2000 00:00:00 GMT"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>776</span>              </span><span class="NAME">xmlhttp.setRequestHeader</span><span class="PUNC">(</span><span class="STRN">"If-Modified-Since"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oldage</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>777</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>778</span>         </span><span class="NAME">xmlhttp.send</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>779</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>780</span>     </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>781</span>         </span><span class="NAME">Sarissa.updateCursor</span><span class="PUNC">(</span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"auto"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>782</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>783</span>         	</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">sFromUrl</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>784</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>785</span>         </span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>786</span>         	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>787</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>788</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>789</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>790</span> 
<span class='linenumber'>791</span> </span><span class="COMM">/**
<span class='linenumber'>792</span>  * Update an element's content with the given DOM node. Passing a configured XSLT 
<span class='linenumber'>793</span>  * processor will result in transforming and updating oNode before using it to update oTargetElement.
<span class='linenumber'>794</span>  * You can also pass a callback function to be executed when the update is finished. The function will be called as 
<span class='linenumber'>795</span>  * &lt;code>functionName(oNode, oTargetElement);&lt;/code>
<span class='linenumber'>796</span>  * @memberOf Sarissa
<span class='linenumber'>797</span>  * @param {DOMNode} oNode the URL to make the request to
<span class='linenumber'>798</span>  * @param {DOMElement} oTargetElement the element to update
<span class='linenumber'>799</span>  * @param {XSLTProcessor} xsltproc (optional) the transformer to use on the given 
<span class='linenumber'>800</span>  *                  DOM node before updating the target element with it
<span class='linenumber'>801</span>  */</span><span class="WHIT">
<span class='linenumber'>802</span> </span><span class="NAME">Sarissa.updateContentFromNode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">xsltproc</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>803</span>     </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>804</span>         </span><span class="NAME">Sarissa.updateCursor</span><span class="PUNC">(</span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"wait"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>805</span>         </span><span class="NAME">Sarissa.clearChildNodes</span><span class="PUNC">(</span><span class="NAME">oTargetElement</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>806</span>         </span><span class="COMM">// check for parsing errors</span><span class="WHIT">
<span class='linenumber'>807</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ownerDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oNode.nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Node.DOCUMENT_NODE</span><span class="PUNC">?</span><span class="NAME">oNode</span><span class="PUNC">:</span><span class="NAME">oNode.ownerDocument</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>808</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ownerDoc.parseError</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">ownerDoc.parseError.errorCode</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>809</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pre</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">"pre"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>810</span>             </span><span class="NAME">pre.appendChild</span><span class="PUNC">(</span><span class="NAME">document.createTextNode</span><span class="PUNC">(</span><span class="NAME">Sarissa.getParseErrorText</span><span class="PUNC">(</span><span class="NAME">ownerDoc</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>811</span>             </span><span class="NAME">oTargetElement.appendChild</span><span class="PUNC">(</span><span class="NAME">pre</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>812</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>813</span>         </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>814</span>             </span><span class="COMM">// transform if appropriate</span><span class="WHIT">
<span class='linenumber'>815</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">xsltproc</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>816</span>                 </span><span class="NAME">oNode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">xsltproc.transformToDocument</span><span class="PUNC">(</span><span class="NAME">oNode</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>817</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>818</span>             </span><span class="COMM">// be smart, maybe the user wants to display the source instead</span><span class="WHIT">
<span class='linenumber'>819</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oTargetElement.tagName.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"textarea"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">oTargetElement.tagName.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"input"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>820</span>                 </span><span class="NAME">oTargetElement.value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XMLSerializer</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">serializeToString</span><span class="PUNC">(</span><span class="NAME">oNode</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>821</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>822</span>             </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>823</span>                 </span><span class="COMM">// ok that was not smart; it was paranoid. Keep up the good work by trying to use DOM instead of innerHTML</span><span class="WHIT">
<span class='linenumber'>824</span>                 </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>825</span>                     </span><span class="NAME">oTargetElement.appendChild</span><span class="PUNC">(</span><span class="NAME">oTargetElement.ownerDocument.importNode</span><span class="PUNC">(</span><span class="NAME">oNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>826</span>                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>827</span>                 </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>828</span>                     </span><span class="NAME">oTargetElement.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XMLSerializer</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">serializeToString</span><span class="PUNC">(</span><span class="NAME">oNode</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>829</span>                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>830</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>831</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>832</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>833</span>     </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>834</span>     	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>835</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>836</span>     </span><span class="KEYW">finally</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>837</span>         </span><span class="NAME">Sarissa.updateCursor</span><span class="PUNC">(</span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"auto"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>838</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>839</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>840</span> 
<span class='linenumber'>841</span> 
<span class='linenumber'>842</span> </span><span class="COMM">/**
<span class='linenumber'>843</span>  * Creates an HTTP URL query string from the given HTML form data
<span class='linenumber'>844</span>  * @memberOf Sarissa
<span class='linenumber'>845</span>  * @param {HTMLFormElement} oForm the form to construct the query string from
<span class='linenumber'>846</span>  */</span><span class="WHIT">
<span class='linenumber'>847</span> </span><span class="NAME">Sarissa.formToQueryString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oForm</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>848</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">qs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>849</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">oForm.elements.length</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>850</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oField</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oForm.elements</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>851</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sFieldName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oField.getAttribute</span><span class="PUNC">(</span><span class="STRN">"name"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">oField.getAttribute</span><span class="PUNC">(</span><span class="STRN">"name"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">oField.getAttribute</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>852</span>         </span><span class="COMM">// ensure we got a proper name/id and that the field is not disabled</span><span class="WHIT">
<span class='linenumber'>853</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">sFieldName</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> 
<span class='linenumber'>854</span>             </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">oField.disabled</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">oField.type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"hidden"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>855</span>             </span><span class="KEYW">switch</span><span class="PUNC">(</span><span class="NAME">oField.type</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>856</span>                 </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"hidden"</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>857</span>                 </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"text"</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>858</span>                 </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"textarea"</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>859</span>                 </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"password"</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>860</span>                     </span><span class="NAME">qs</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sFieldName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">oField.value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"&"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>861</span>                     </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>862</span>                 </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"select-one"</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>863</span>                     </span><span class="NAME">qs</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sFieldName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">oField.options</span><span class="PUNC">[</span><span class="NAME">oField.selectedIndex</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"&"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>864</span>                     </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>865</span>                 </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"select-multiple"</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>866</span>                     </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">oField.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>867</span>                         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">optElem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oField.options</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>868</span>                         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">optElem.selected</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>869</span>                             </span><span class="NAME">qs</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sFieldName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"[]"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">optElem.value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"&"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>870</span>                         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>871</span>                      </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>872</span>                      </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>873</span>                 </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"checkbox"</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>874</span>                 </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"radio"</span><span class="PUNC">:</span><span class="WHIT">
<span class='linenumber'>875</span>                     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oField.checked</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>876</span>                         </span><span class="NAME">qs</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sFieldName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">oField.value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"&"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>877</span>                     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>878</span>                     </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>879</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>880</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>881</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>882</span>     </span><span class="COMM">// return after removing last '&'</span><span class="WHIT">
<span class='linenumber'>883</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">qs.substr</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">qs.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>884</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>885</span> 
<span class='linenumber'>886</span> 
<span class='linenumber'>887</span> </span><span class="COMM">/**
<span class='linenumber'>888</span>  * Asynchronously update an element with response of an XMLHttpRequest-based emulation of a form submission. &lt;p>The form &lt;code>action&lt;/code> and 
<span class='linenumber'>889</span>  * &lt;code>method&lt;/code> attributess will be followed. Passing a configured XSLT processor will result in 
<span class='linenumber'>890</span>  * transforming and updating the server response before using it to update the target element.
<span class='linenumber'>891</span>  * You can also pass a callback function to be executed when the update is finished. The function will be called as 
<span class='linenumber'>892</span>  * &lt;code>functionName(oNode, oTargetElement);&lt;/code>&lt;/p>
<span class='linenumber'>893</span>  * &lt;p>Here is an example of using this in a form element:&lt;/p>
<span class='linenumber'>894</span>  * &lt;pre name="code" class="xml">
<span class='linenumber'>895</span>  * &lt;div id="targetId"&gt; this content will be updated&lt;/div&gt;
<span class='linenumber'>896</span>  * &lt;form action="/my/form/handler" method="post" 
<span class='linenumber'>897</span>  *     onbeforesubmit="return Sarissa.updateContentFromForm(this, document.getElementById('targetId'));"&gt;&lt;pre>
<span class='linenumber'>898</span>  * &lt;p>If JavaScript is supported, the form will not be submitted. Instead, Sarissa will
<span class='linenumber'>899</span>  * scan the form and make an appropriate AJAX request, also adding a parameter 
<span class='linenumber'>900</span>  * to signal to the server that this is an AJAX call. The parameter is 
<span class='linenumber'>901</span>  * constructed as &lt;code>Sarissa.REMOTE_CALL_FLAG = "=true"&lt;/code> so you can change the name in your webpage
<span class='linenumber'>902</span>  * simply by assigning another value to Sarissa.REMOTE_CALL_FLAG. If JavaScript is not supported
<span class='linenumber'>903</span>  * the form will be submitted normally.
<span class='linenumber'>904</span>  * @memberOf Sarissa
<span class='linenumber'>905</span>  * @param {HTMLFormElement} oForm the form submition to emulate
<span class='linenumber'>906</span>  * @param {DOMElement} oTargetElement the element to update
<span class='linenumber'>907</span>  * @param {XSLTProcessor} xsltproc (optional) the transformer to use on the returned
<span class='linenumber'>908</span>  *                  content before updating the target element with it
<span class='linenumber'>909</span>  * @param {Function} callback (optional) a Function object to execute once the update is finished successfuly, called as &lt;code>callback(oNode, oTargetElement)&lt;/code>. 
<span class='linenumber'>910</span>  *        In case an exception occurs during excecution and a callback function was provided, the exception is cought and the callback is called as 
<span class='linenumber'>911</span>  *        &lt;code>callback(oForm, oTargetElement, exception)&lt;/code>
<span class='linenumber'>912</span>  */</span><span class="WHIT">
<span class='linenumber'>913</span> </span><span class="NAME">Sarissa.updateContentFromForm</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oForm</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">xsltproc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>914</span>     </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>915</span>     	</span><span class="NAME">Sarissa.updateCursor</span><span class="PUNC">(</span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"wait"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>916</span>         </span><span class="COMM">// build parameters from form fields</span><span class="WHIT">
<span class='linenumber'>917</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.formToQueryString</span><span class="PUNC">(</span><span class="NAME">oForm</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"&"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">Sarissa.REMOTE_CALL_FLAG</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"=true"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>918</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">xmlhttp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XMLHttpRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>919</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">bUseGet</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oForm.getAttribute</span><span class="PUNC">(</span><span class="STRN">"method"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">oForm.getAttribute</span><span class="PUNC">(</span><span class="STRN">"method"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"get"</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>920</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">bUseGet</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>921</span>             </span><span class="NAME">xmlhttp.open</span><span class="PUNC">(</span><span class="STRN">"GET"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oForm.getAttribute</span><span class="PUNC">(</span><span class="STRN">"action"</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">"?"</span><span class="PUNC">+</span><span class="NAME">params</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>922</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>923</span>         </span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>924</span>             </span><span class="NAME">xmlhttp.open</span><span class="PUNC">(</span><span class="STRN">'POST'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oForm.getAttribute</span><span class="PUNC">(</span><span class="STRN">"action"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>925</span>             </span><span class="NAME">xmlhttp.setRequestHeader</span><span class="PUNC">(</span><span class="STRN">"Content-type"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"application/x-www-form-urlencoded"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>926</span>             </span><span class="NAME">xmlhttp.setRequestHeader</span><span class="PUNC">(</span><span class="STRN">"Content-length"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">params.length</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>927</span>             </span><span class="NAME">xmlhttp.setRequestHeader</span><span class="PUNC">(</span><span class="STRN">"Connection"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"close"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>928</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>929</span>         </span><span class="NAME">xmlhttp.onreadystatechange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>930</span>         	</span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>931</span> 	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">xmlhttp.readyState</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>932</span> 	            	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oDomDoc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">xmlhttp.responseXML</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>933</span> 	            	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oDomDoc</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">Sarissa.getParseErrorText</span><span class="PUNC">(</span><span class="NAME">oDomDoc</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Sarissa.PARSED_OK</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>934</span> 		                </span><span class="NAME">Sarissa.updateContentFromNode</span><span class="PUNC">(</span><span class="NAME">xmlhttp.responseXML</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">xsltproc</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>935</span>         				</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>936</span> 		                	</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">oForm</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>937</span> 		                </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>938</span> 	            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>939</span> 	            	</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>940</span> 	            		</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="NAME">Sarissa.getParseErrorText</span><span class="PUNC">(</span><span class="NAME">oDomDoc</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>941</span> 	            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>942</span> 	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>943</span>         	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>944</span>         	</span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>945</span>         		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>946</span>         			</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">oForm</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>947</span>         		</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>948</span>         		</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>949</span>         			</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>950</span>         		</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>951</span>         	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>952</span>         </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>953</span>         </span><span class="NAME">xmlhttp.send</span><span class="PUNC">(</span><span class="NAME">bUseGet</span><span class="PUNC">?</span><span class="STRN">""</span><span class="PUNC">:</span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>954</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>955</span>     </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>956</span>         </span><span class="NAME">Sarissa.updateCursor</span><span class="PUNC">(</span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"auto"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>957</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>958</span>         	</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">oForm</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oTargetElement</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>959</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>960</span>         </span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>961</span>         	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>962</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>963</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>964</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>965</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>966</span> </span><span class="NAME">Sarissa.FUNCTION_NAME_REGEXP</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">RegExp</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="COMM">//new RegExp("function\\s+(\\S+)\\s*\\((.|\\n)*?\\)\\s*{");</span><span class="WHIT">
<span class='linenumber'>967</span> </span><span class="COMM">/**
<span class='linenumber'>968</span>  * Get the name of a function created like:
<span class='linenumber'>969</span>  * &lt;pre>function functionName(){}&lt;/pre>
<span class='linenumber'>970</span>  * If a name is not found and the bForce parameter is true,
<span class='linenumber'>971</span>  * attach the function to the window object with a new name and
<span class='linenumber'>972</span>  * return that
<span class='linenumber'>973</span>  * @param {Function} oFunc the function object
<span class='linenumber'>974</span>  * @param {boolean} bForce whether to force a name under the window context if none is found
<span class='linenumber'>975</span>  */</span><span class="WHIT">
<span class='linenumber'>976</span> </span><span class="NAME">Sarissa.getFunctionName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oFunc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bForce</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>977</span> 	</span><span class="COMM">//alert("Sarissa.getFunctionName oFunc: "+oFunc);</span><span class="WHIT">
<span class='linenumber'>978</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>979</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>980</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">bForce</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>981</span> 			</span><span class="COMM">// attach to window object under a new name</span><span class="WHIT">
<span class='linenumber'>982</span> 			</span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"SarissaAnonymous"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">Sarissa._getUniqueSuffix</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>983</span> 			</span><span class="NAME">window</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oFunc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>984</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>985</span> 		</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>986</span> 			</span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>987</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>988</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>989</span> 	
<span class='linenumber'>990</span> 	</span><span class="COMM">//alert("Sarissa.getFunctionName returns: "+name);</span><span class="WHIT">
<span class='linenumber'>991</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>992</span> 		</span><span class="NAME">window</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oFunc</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>993</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>994</span> 	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>995</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>996</span> 
<span class='linenumber'>997</span> </span><span class="COMM">/**
<span class='linenumber'>998</span>  *
<span class='linenumber'>999</span>  */</span><span class="WHIT">
<span class='linenumber'>1000</span> </span><span class="NAME">Sarissa.setRemoteJsonCallback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callbackParam</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1001</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">callbackParam</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1002</span> 		</span><span class="NAME">callbackParam</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"callback"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1003</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1004</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">callbackFunctionName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sarissa.getFunctionName</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1005</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"sarissa_json_script_id_"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">Sarissa._getUniqueSuffix</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>1006</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oHead</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementsByTagName</span><span class="PUNC">(</span><span class="STRN">"head"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1007</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">scriptTag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">'script'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1008</span> 	</span><span class="NAME">scriptTag.type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'text/javascript'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1009</span> 	</span><span class="NAME">scriptTag.id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1010</span> 	</span><span class="NAME">scriptTag.onload</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1011</span> 		</span><span class="COMM">// cleanUp</span><span class="WHIT">
<span class='linenumber'>1012</span> 		</span><span class="COMM">// document.removeChild(scriptTag);</span><span class="WHIT">
<span class='linenumber'>1013</span> 	</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1014</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">url.indexOf</span><span class="PUNC">(</span><span class="STRN">"?"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1015</span> 		</span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">"&"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">callbackParam</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">callbackFunctionName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1016</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1017</span> 	</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1018</span> 		</span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">"?"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">callbackParam</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">callbackFunctionName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1019</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1020</span> 	</span><span class="NAME">scriptTag.src</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1021</span>   	</span><span class="NAME">oHead.appendChild</span><span class="PUNC">(</span><span class="NAME">scriptTag</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1022</span>   	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1023</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1024</span> 
<span class='linenumber'>1025</span> </span><span class="COMM">//   EOF</span><span class="WHIT">
<span class='linenumber'>1026</span> </span></pre></body></html>